﻿@{
    ViewBag.Title = "邮箱认证";
    Layout = "~/Views/Shared/_LayoutFore.cshtml";
}

@section script{
    <script type="text/javascript">
        $(function () {
            $("form").Validform({
                tiptype: 3
            });
        })

        //点击验证码
        $("#valiCode").click(function () {
            this.src = "/Login/GetValidateCode?time=" + (new Date()).getTime();
        }); 
        function EmailCertificationOnSuccess(data) {
            if (data.Status == 1) {
                $.dialog.alert(data.Message, function () {
                    window.location.href = data.Data;
                });
                return true;
            } else {
                $.dialog.alert(data.Message);
                return false;
            }
        }

        //验证邮箱是否已经注册
        $("#Email").blur(function () {
            var email = $("#Email").val();

            $.post("/Login/checkUsed", { Email: email }, function (data) {
                if (data.Status == -1) {
                    if (email.trim() == "") {

                    } else {
                        $.dialog.alert(data.Message);
                    }
                    $("#Email").val("");
                    return false;
                } else {
                    $("#btnPaySure").attr("type", "submit");
                }
            });
        });

    </script>

    <style>
        .tab-content dl dt:first-child {
            width: 120px;
            text-align: right;
        }
    </style>
}
<div class="RightContrent">
    <div style="margin-left: 50px; margin-right: 50px;">
        <div class="tab-content">
            <div class="line10"></div>
            <div class="line10"></div>
            <div class="tab_title">@ViewBag.Title</div>
            <div class="tab-content">
                <div style="width: 16px; height: 12px; float: left;">
                    <img src="~/Content/Images/leftarraw.png" />
                </div>
            </div>

            <div class="tab-content_border">

                <div class="u-center">
                    <div class="u-form-wrap">
                        @using (Ajax.BeginForm("SendCertification", new AjaxOptions() { OnSuccess = "EmailCertificationOnSuccess" }))
                        {
                            <input type="hidden" name="ID" id="ID" value="@ViewBag.Id" />
                            <div class="tab-content">
                                <dl>
                                    <dt>请输入账户登录密码：</dt>
                                    <dd>
                                        <input type="password" style="width: 200px;" class="input normal" name="txtPwd" id="txtPwd" datatype = "*6-20" nullmsg = "请输入账户登录密码" errormsg = "密码范围在6-20位之间" sucmsg = " "  />
                                    </dd>
                                </dl>
                                <dl>
                                    <dt>请输入邮箱：</dt>
                                    <dd>
                                        @Html.TextBox("Email", null, new { @class = "input normal", datatype = "e", nullmsg = "请输入邮箱", errormsg = "邮箱地址不正确，请重新输入！", sucmsg = " " })

                                    </dd>
                                </dl>
                                <dl>
                                    <dt>请输入验证码：</dt>
                                    <dd>
                                        <input type="text" style="width: 200px;" class="input normal" name="validateCode" id="validateCode" datatype="*" maxlength="5" />
                                        <img id="valiCode" width="80" height="26" src="/Login/GetValidateCode" />
                                    </dd>
                                </dl>
                                <dl>
                                    <dd style="margin-left: 120px">
                                        <input type="submit" value="发送邮箱验证" id="btnPaySure" name="btnPaySure" class="btn" />

                                        <a href='@Url.Action("Index")' class="btn" style="color:white">返回</a>
                                    </dd>
                                </dl>
                            </div>
                        }
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
